package Book;
//抽象出存放书籍的书架类bookList
public class bookList {
    //定义一个book类型的数组存放书籍
    private book[] books=new book[10];
    private int useMount;


    /**
     * 书架的无参构造方法，当实例化书架的对象时，书架会自动初始化放上三本书；
     */
    public bookList() {
        books[0]=new book ("西游记","罗贯中",90.5,"小说");
        books[1]=new book ("红楼梦","曹雪芹",86.5,"小说");
        books[2]=new book ("java深度解析","大聪明",55.5,"科学");
        this.useMount=3;
    }

    /**
     *
     * @return 获取当前书架已存在的书籍数目
     */
    public int getUseMount() {
        return useMount;
    }

    /**
     *
     * @param useMount 修改书架中书本数目
     */
    public void setUseMount(int useMount) {
        this.useMount = useMount;
    }

    /**
     *在book数组的pos下标元素里添加书的对象
     * @param pos 放入书架的下标
     * @param book 放入的书对象
     */
    public void setBooks(int pos,book book) {
        books[pos]=book;
        this.useMount++;
    }

    /**
     *返回book数组的pos下标元素里书的对象
     * @param pos 要获取书的下标
     * @param
     * @return
     */
    public book getBooks(int pos) {

        return books[pos];
    }
}
